{template 'public/header'}
{template 'public/comhead'}
<link rel="stylesheet" type="text/css" href="../addons/zh_tcwq/template/public/ygcsslist.css">
<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>    
    <li class="active"><a href="{php echo $this->createWebUrl('inad')}">广告管理</a></li>
    <li><a href="{php echo $this->createWebUrl('inaddad')}">添加广告</a></li>
</ul>
<div class="main">
    <div class="panel panel-default">
        <div class="panel-heading">
            广告管理
        </div>
        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row">
                <table class="yg5_tabel col-md-12">
                    <tr class="yg5_tr1">
                        <th class="store_td1 col-md-1">排序</th>
                        <th class="col-md-2">标题</th>
                        <th class="col-md-2">图片</th>
                       <!--  <th class="col-md-2">链接地址</th> -->
                        <th class="col-md-1">类型</th>
                     <!--    <th class="col-md-1">城市</th> -->
                        <th class="col-md-1">状态</th>
                        <th class="col-md-2">操作</th>
                    </tr>
                    {loop $list $row}
                    <tr class="yg5_tr2">
                        <!-- <td><div class="type-parent">{$row['orderby']}&nbsp;&nbsp;</div></td> -->
                        <tr class="yg5_tr2">
                            <td class="num{$row['id']}">
                                <span class="numspan{$row['id']}">{$row['orderby']}</span>
                                <input style="display: none;width: 100%;" type="number" name="num{$row['id']}" class="numinp{$row['id']}" value="{$row['orderby']}" />
                                <script type="text/javascript">
                                    $(function(){
                                        $(".num{$row['id']}").each(function(index){
                                             $(this).dblclick(function(){
                                                $(".numinp{$row['id']}").eq(index).show().focus();
                                                $(".numspan{$row['id']}").eq(index).hide();                                         
                                            });
                                        });
                                        $(".numinp{$row['id']}").each(function(index){
                                            $(this).blur(function(){       
                                                $(".numinp{$row['id']}").eq(index).hide();
                                                $(".numspan{$row['id']}").eq(index).show();
                                                var text = $(".numspan{$row['id']}").html();
                                                var inp = $(" input[ name='num{$row['id']}' ] ").val();
                                                $(".numspan{$row['id']}").html(inp);
                                                console.log(inp);
                                                id = {$row['id']};
                                                num = inp;
                                                $.ajax({
                                                    type:"post",
                                                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=UpdAd&m=zh_tcwq",
                                                    dataType:"text",
                                                    data:{id:id,num:num},
                                                    success:function(data){
                                                        console.log(data);
                                                    }
                                                })
                                        
                                            });
                                        });
                                    })
                                </script>
                            </td>
                        <td>{$row['title']}</td>
                        <td><div class="type-parent"><img height="40" src="{media $row['logo']}">&nbsp;&nbsp;</div></td>
                       <!--  <td><div class="type-parent">{$row['src']}&nbsp;&nbsp;</div></td> -->
                         <td><div class="type-parent">{if $row['type']==1}首页幻灯片{elseif $row['type']==2}商家页面幻灯片{elseif $row['type']==3}资讯页面幻灯片{elseif $row['type']==4}拼车页面幻灯片{elseif $row['type']==5}开屏广告{elseif $row['type']==6}黄页广告{elseif $row['type']==7}首页广告位{/if}</div></td>
                       <!--   <td><div class="type-parent">{$row['cityname']}&nbsp;&nbsp;</div></td> -->
                        {if $row['status']==1}
                        <td><button type="button" class="btn ygyouhui2 btn-sm" data-toggle="modal" data-target="#myModal2{$row['id']}">点击禁用</button></td>
                        {elseif $row['status']==2}
                        <td><button type="button" class="btn storegrey2 btn-sm" data-toggle="modal" data-target="#myModal3{$row['id']}">点击启用</button></td>
                        {/if}
                        <td>
                            <a href="{php echo $this->createWebUrl('inaddad', array('id' => $row['id']))}" class="storespan btn btn-xs">
                                <span class="fa fa-pencil"></span>
                                <span class="bianji">编辑
                                    <span class="arrowdown"></span>
                                </span>                            
                            </a>
                            <!-- <a class="btn btn-warning btn-sm" href="{php echo $this->createWebUrl('inaddad', array('id' => $row['id']))}" title="编辑">改</a>&nbsp;&nbsp; -->
                            <!-- <button type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#myModal{$row['id']}">删</button></td> -->
                    </tr>
                    <div class="modal fade" id="myModal{$row['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定删除么？
                        </div>
                        <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl('inad', array('op' => 'delete', 'id' => $row['id']))}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal fade" id="myModal2{$row['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定要禁用么？
                        </div>
                        <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl('inad', array('status' => 2, 'id' => $row['id']))}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal fade" id="myModal3{$row['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定要启用么？
                        </div>
                        <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl('inad', array('status' => 1, 'id' => $row['id']))}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>
                    {/loop}
                     {if empty($list)}
                      <tr class="yg5_tr2">
                      <td colspan="12">
                            暂无商家信息
                        </td>
                    </tr>
                    {/if}

            
                </table>
            </div>
        </form>
    </div>

</div>
<div class="text-right we7-margin-top">
   {$pager}
</div>
<script type="text/javascript">
    $(function(){
        $("#frame-6").show();
        $("#yframe-6").addClass("wyactive");
    })
</script>